package com.aps.common.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;

/**
 * 产品信息数据模型
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "产品信息数据模型")
public class ProductInfo {
    
    @NotBlank(message = "产品ID不能为空")
    @JsonProperty("productId")
    @Schema(description = "产品ID", example = "P001")
    private String productId;
    
    @NotBlank(message = "产品名称不能为空")
    @JsonProperty("productName")
    @Schema(description = "产品名称", example = "汽车齿轮")
    private String productName;
    
    @NotBlank(message = "产品类别不能为空")
    @JsonProperty("productCategory")
    @Schema(description = "产品类别", example = "齿轮")
    private String productCategory;
    
    @JsonProperty("description")
    @Schema(description = "产品描述", example = "高精度汽车齿轮")
    private String description;
    
    @NotBlank(message = "材料不能为空")
    @JsonProperty("material")
    @Schema(description = "材料", example = "合金钢")
    private String material;
    
    @NotNull(message = "产品规格不能为空")
    @JsonProperty("specifications")
    @Schema(description = "产品规格")
    private ProductSpecifications specifications;
    
    @Positive(message = "年需求量必须为正数")
    @JsonProperty("annualDemand")
    @Schema(description = "年需求量", example = "10000")
    private Integer annualDemand;
    
    /**
     * 产品规格信息
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "产品规格信息")
    public static class ProductSpecifications {
        
        @JsonProperty("outerDiameter")
        @Schema(description = "外径规格")
        private Specification outerDiameter;
        
        @JsonProperty("height")
        @Schema(description = "高度规格")
        private Specification height;
        
        @JsonProperty("weight")
        @Schema(description = "重量规格")
        private Specification weight;
        
        /**
         * 规格参数
         */
        @Data
        @NoArgsConstructor
        @AllArgsConstructor
        @Schema(description = "规格参数")
        public static class Specification {
            @NotNull(message = "数值不能为空")
            @JsonProperty("value")
            @Schema(description = "数值", example = "50.0")
            private Double value;
            
            @NotBlank(message = "单位不能为空")
            @JsonProperty("unit")
            @Schema(description = "单位", example = "mm")
            private String unit;
            
            @JsonProperty("tolerance")
            @Schema(description = "公差", example = "±0.1")
            private String tolerance;
        }
    }
} 